%% Build the dotris game from its configuration script
clear classes
clc

% client and server morde properties determine where game graphics will
% show up:
%   - with serverMode and clientMode the same, graphics will show up here
%   on this machine, within this Matlab session
%   - with serverMode false and clientMode true, this Matlab will request
%   graphics from a Snow Dots server, which must be running in a different
%   Matlab session, on this machine or another machine connected via
%   Ethernet.
dotsTheDrawablesManager.reset('serverMode', false, 'clientMode', false);

% configureDotris defines the game
[tree, list] = configureDotris;

%% launch the game from the topsTreeNode gui
% get a fresh data log, write new data to disk
topsDataLog.flushAllData;
tree.run;

% may wish to write the data to disk
dataDileWithPath = fullfile('~', 'dotrisData');
topsDataLog.writeDataFile(dataDileWithPath);

%% summary of piece types
% looks at data stored in topsTheDataLog and plots a summary of the
% player's behavior during the game
analyzeDotris;

%% summary of event times
% plots dotris timstamps stored in topsTheDataLog
plotDotrisTiming;